#include <forward_list>
#include <iostream>
#include <format>
int main()
{
    std::forward_list<int> f_list{1,2,3,4,5};
    auto it = f_list.begin();
    while(it != f_list.end()){
        std::cout<<std::format("{}\n",*it);
        f_list.insert_after(it,1);  //在迭代器后面插入一个元素
        it++;it++; //跳过当前元素和添加的元素,不然会陷入死循环
    }
    f_list.reverse();
    std::cout<<"reverse:\n";
    it = f_list.begin();
        while(it != f_list.end()){
        std::cout<<std::format("{}\n",*it);
        it++;
    }
    std::cout<<std::format("Max Size:{}",f_list.max_size());
}